<!-- Modal -->
<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">X</button>
    <h3 id="myModalLabel">Confirm!</h3>
  </div>
  <div class="modal-body">
	
		<div class="alert">
			Are You sure you want to delete <h1><?=ucwords($emp->firstname." ".$emp->lastname);?>?</h1>
			<br>
			and all data included to this user?
		
		</div>
	<form action="<?=site_url('employee/update/'.$emp->id);?>" method="POST">
		<input type="hidden" name="employee_id" value="<?=$emp->id;?>">
		<input type="submit" class="btn btn-primary" name="delete_employee_data" value="Yes Delete employee and All data">
	</form>
  </div>
  <div class="modal-footer">
    <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
  </div>
</div>







<div class="row-fluid">
		<div class="span8">
		<?=$system_message;?>
		<?=validation_errors() !=='' ? '<div class="alert alert-error">'.validation_errors().'</div>' : NULL;?>
		
		<!-- Updateing department and role -->
		<div class="well">
		<fieldset>
		<legend>Department And Role</legend>
		<form action="<?=site_url('employee/update/'.$emp->id);?>"class="form-horizontal" method="POST">
		<div class="control-group">
			<label class="control-label" for="inputEmail">Department</label>
			<div class="controls">
				<?=form_dropdown('department',$department_opt,set_value('department',$emp->pid),'class="department_picker" data-url="'.site_url('outputs/positions').'"data-auth="'.$auth.'"');?>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label" for="inputEmail">Position</label>
			<div id="position-dropdown" class="controls">
				<p><?=ucwords($emp->pname);?></p>
			</div>
		</div>
			<div class="control-group">
				<div class="controls">
				<input type="hidden" name="form_token" value="<?=$form_token;?>">
				<input type="hidden" name="employee_id" value="<?=$employee_id;?>">
				<input type="submit" name="updatedepartmentandrole" value="Save Changes" class="btn btn-primary">
				</div>
			</div>
		</form>
		</fieldset>
		</div>
		
		
		
		
		<!-- Updating profile -->
		<div class="well">
		<fieldset>
		<legend>Update Employee Profile</legend>
		<?if(!empty($emp)):?>
		<form class="form-horizontal" action="<?=site_url('employee/update/'.$emp->id);?>" method="POST">
			<div class="control-group">
				<label class="control-label" for="inputEmail">Firstname</label>
				<div class="controls">
				<input type="text" name="firstname" class="span8" placeholder="Firstname" value="<?=set_value('firstname',$emp->firstname);?>" required>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="inputEmail">Lastname</label>
				<div class="controls">
				<input type="text" name="lastname" class="span8" placeholder="Lastname" value="<?=set_value('lastname',$emp->lastname);?>"  required>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="inputEmail">Middlename</label>
				<div class="controls">
				<input type="text" name="middlename"class="span8" placeholder="Middlename" value="<?=set_value('middlename',$emp->middlename);?>"  required>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="inputEmail">gender</label>
				<div class="controls">
				<?=form_dropdown('gender',$gender_opt,set_value('gender',$emp->gender),'class="span4" required');?>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="inputEmail">Address</label>
				<div class="controls">
				<textarea name="address" class="span8" placeholder="Address" required><?=set_value('address',$emp->address);?></textarea>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="inputEmail">Marital Status</label>
				<div class="controls">
				<?=form_dropdown('status',$status_opt,set_value('status',$emp->status),'class="span4" required');?>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="inputEmail">Dependents</label>
				<div class="controls">
				<input type="text" name="dependents" class="span8" value="<?=set_value('dependents',$emp->dependents);?>"  placeholder="dependents" required>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="inputEmail">Monthly Salary</label>
				<div class="controls">
					<div class="input-prepend">
					  <span class="add-on">&#8369;</span>
					  <input class="span8" id="prependedInput" type="text" name="monthly_salary" value="<?=set_value('monthly_salary',$emp->monthly_salary);?>"  placeholder="monthly salary" required>
					</div>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="inputEmail"></label>
				<div class="controls">
				<input type="submit" name="update_employee" value="Save Changes" class="btn btn-primary">
				</div>
			</div>
		</form>
		<?else:?>
			<div class="alert alert-error">
				<h1>Warning</h1>
				<p>Employee data was not found.</p>
			</div>
		<? endif;?>
		</fieldset>
		</div>
		
		<!-- Adding of login credentials -->
		<div class="well">
		<fieldset>
		<legend>Login Credentials</legend>
		<form action="<?=site_url('employee/update/'.$emp->id);?>"class="form-horizontal" method="POST">
			<div class="control-group">
				<label class="control-label" for="inputEmail">username (for Login):</label>
				<div class="controls">
				<input type="text" name="username" class="span8 login-cred" value="<?=set_value('username');?>"  placeholder="Username" required >
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="inputEmail">Password:</label>
				<div class="controls">
				<input type="password" name="password" class="span8 login-cred"  placeholder="Password" required>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="inputEmail">Confirm Password:</label>
				<div class="controls">
				<input type="password" name="cpassword" class="span8 login-cred"   placeholder="confirm password" required>
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="inputEmail">Role:</label>
				<div class="controls">
				<?=form_dropdown('role',$role_opt,set_value('role'),'class="span4" required');?>
				</div>
			</div>
			<div class="control-group">
				<div class="controls">
				<input type="hidden" name="form_token" value="<?=$form_token;?>">
				<input type="hidden" name="employee_id" value="<?=$employee_id;?>">
				<input type="submit" name="createlogin" value="Save Login" class="btn btn-primary">
				</div>
			</div>
		</form>
		</fieldset>
		</div>
		
		
		<!-- Deleteing of employee -->
		<div class="well">
		<fieldset>
			<legend>Delete Employee</legend>
			<a href="#myModal" role="button" class="btn" data-toggle="modal">Delete Employee And All Data</a>
		</fieldset>
		</div>
	</div>
</div>